package com.pengtu.entity.business.labs;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Where;

import com.pengtu.entity.IdEntity;
import com.pengtu.entity.app.Attachment;

/**
 * 试验室设立授权书
 * @author liuyang
 *
 */
@Entity
@Table(name = "T_Q_CASE_LABS_AUTHORIZATION")
public class LabsAuthorization extends IdEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String code; 						//编号
	private String pid;							//工程
	private FlowLabsFiling flowLabsFiling;		//流程
	private String deptId;						//部门
	private String cachet;						//公章全称
	private String principal;					//负责人
	private String principalNum;				//负责人检测工作证编号
	private String content;						//授权的试验项目
	private Date startDate;						//授权有效期开始时间
	private Date endDate;						//授权有效期结束时间
	private String agencyLevel;					//授权机构等级
	private String agencyName;					//授权机构名称
	private Date agencyDate; 					//授权时间
	private String agencyer;					//授权人
	private String remark;						//备注
	private Set<Attachment> attachments =  new HashSet<Attachment>(0);
	
	@Column(name="CODE")
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	@Column(name="PROJID")
	public String getPid() {
		return pid;
	}
	public void setPid(String pid) {
		this.pid = pid;
	}
	
	@ManyToOne(targetEntity=FlowLabsFiling.class)
	@JoinColumn(name="FID")
	public FlowLabsFiling getFlowLabsFiling() {
		return flowLabsFiling;
	}
	public void setFlowLabsFiling(FlowLabsFiling flowLabsFiling) {
		this.flowLabsFiling = flowLabsFiling;
	}
	
	@Column(name="DEPTID")
	public String getDeptId() {
		return deptId;
	}
	public void setDeptId(String deptId) {
		this.deptId = deptId;
	}
	
	@Column(name="CACHET")
	public String getCachet() {
		return cachet;
	}
	public void setCachet(String cachet) {
		this.cachet = cachet;
	}
	
	@Column(name="PRINCIPAL")
	public String getPrincipal() {
		return principal;
	}
	public void setPrincipal(String principal) {
		this.principal = principal;
	}
	
	@Column(name="PRINCIPALNUM")
	public String getPrincipalNum() {
		return principalNum;
	}
	public void setPrincipalNum(String principalNum) {
		this.principalNum = principalNum;
	}
	
	@Column(name="CONTENT")
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	
	@Column(name="STARTDATE")
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}
	
	@Column(name="ENDDATE")
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	@Column(name="AGENCYLEVEL")
	public String getAgencyLevel() {
		return agencyLevel;
	}
	public void setAgencyLevel(String agencyLevel) {
		this.agencyLevel = agencyLevel;
	}
	
	@Column(name="AGENCYNAME")
	public String getAgencyName() {
		return agencyName;
	}
	public void setAgencyName(String agencyName) {
		this.agencyName = agencyName;
	}
	
	@Column(name="AGENCYDATE")
	public Date getAgencyDate() {
		return agencyDate;
	}
	public void setAgencyDate(Date agencyDate) {
		this.agencyDate = agencyDate;
	}
	
	@Column(name="AGENCYER")
	public String getAgencyer() {
		return agencyer;
	}
	public void setAgencyer(String agencyer) {
		this.agencyer = agencyer;
	}
	
	@Column(name="REMARK")
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
	@JoinColumn(name = "TABLEID")
	@Where(clause=" delFlag = 0")
	public Set<Attachment> getAttachments() {
		return attachments;
	}
	public void setAttachments(Set<Attachment> attachments) {
		this.attachments = attachments;
	}
}
